<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                template="./../templates/StakeholderPortalTemplate.xhtml">

    <ui:define name="content"> 
            <h:form id="formMain">
                <p:panel id ="abc" header="View All Bills">
                    <p:dataTable var="paymentManagement" value="#{stakeholderManagerBean.paymentManagementList}" paginator="true"
                                 rows="12" emptyMessage="No bill has been sent to you" selection="#{reportManagerBean.selectedBill}" 
                                         selectionMode="single" rowSelectListener="#{reportManagerBean.onRowSelectNavigateBill}">

                        <p:column sortBy="#{paymentManagement.id}" filterBy="#{paymentManagement.id}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Bill ID" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.id}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.startDate}" filterBy="#{paymentManagement.startDate}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Start Date" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.startDate}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.endDate}" filterBy="#{paymentManagement.endDate}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="End Date" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.endDate}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.totalPaymentCurrent}" filterBy="#{paymentManagement.totalPaymentCurrent}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Bill Amount" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.totalPaymentCurrent}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.paymentReceived}" filterBy="#{paymentManagement.paymentReceived}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Amount Paid" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.paymentReceived}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.paymentLeft}" filterBy="#{paymentManagement.paymentLeft}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Amount Left" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.paymentLeft}" />
                        </p:column>

                        <p:column sortBy="#{paymentManagement.dueDate}" filterBy="#{paymentManagement.dueDate}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Due Date" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.dueDate}" />
                        </p:column>
                        <p:column sortBy="#{paymentManagement.expired}" filterBy="#{paymentManagement.expired}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="Paid" />
                            </f:facet>
                            <h:outputText value="#{paymentManagement.expired}" />
                        </p:column>
                    </p:dataTable>
                    <br></br>
                    <h:outputText value="OUT STANDING BILL: #{stakeholderManagerBean.outstandingBillAmount}" style="font-weight:bold"/>
                    <br></br>
                    <p:commandButton actionListener="#{stakeholderManagerBean.payCurentBill}" value="Pay Current Bill">            
                    </p:commandButton>
                </p:panel>
            </h:form>
    </ui:define>
</ui:composition>